<script language="JavaScript" type="text/javascript">
$(document).ready(function (){
	show_menu('文章分类');	
})
</script>
		<!--
		<div class="title">		
			<h2>文章分类</h2>
		</div>
		-->

		<div id="col-left">	
			<div class="box">
				<h3><?=$post_type_title?></h3>
				<?php if($this->session->flashdata('success_message')):?>
				<div id="succeed"><?=$this->session->flashdata('success_message');?></div>
				<?
					echo "<script>setTimeout(function (){document.getElementById('succeed').style.display = 'none';}, 5000)</script>";
				?>
				<?php endif;?>
				
				<?php if($this->session->flashdata('update_message')):?>
				<div id="notice"><?=$this->session->flashdata('update_message');?></div>
				<?
					echo "<script>setTimeout(function (){document.getElementById('notice').style.display = 'none';}, 5000)</script>";
				?>
				<?php endif;?>
				
				<?=validation_errors('<p class="error" style="margin:0;">', '</p>'); ?>
				<?=form_open('admin/post_type', array('id'=>'subForm')); ?>
				<?=form_hidden('id',$id)?>
				
				<ul>					
					<li>
						<label>分类名称</label>
						<div><input type="text" name="name" class="text medium" value="<?=set_value('name', $post_type_name)?>" /></div>
					</li>
					<li>
					<label>分类排序</label>
					<div>
						<?
						$options = array();
						for ($i = 1; $i <= 50; $i++)
						{
							$options[$i] = $i;
						}
						echo form_dropdown('order', $options, set_value('order', $post_type_order == '' ? 10 : $post_type_order));
						?>
					</div>
				</li>
					<li>
						<input type="Submit" value="Submit" class="button" /> 
						<input type="Reset" value="Reset" class="button" />
					</li>
				</ul>
				</form>
			</div>
		</div>

		<div id="col-right">
			<div class="box">
				<h3>已经存在的分类</h3>
				<table>
				<thead>
				<tr>
					<th scope="col">分类</th>
					<th scope="col">排序</th>
					<th scope="col">状态</th>
					<th scope="col">操作</th>
				</tr>
				</thead>
				<tbody>
				<? 
					$tr_class = '';
					foreach ($post_type_records as $post_type_record):
						$tr_class = $tr_class == '' ? 'odd' : '';
				?>
				<tr class="<?=$tr_class?>">
					<td><?=$post_type_record->name?></td>
					<td><?=$post_type_record->order?></td>
					<td>
					<? if ($post_type_record->status): ?>
					<span class="active">显示</span>
					<? else: ?>
					<span class="closed">隐藏</span>
					<? endif; ?>
					</td>
					<?
					if ($post_type_record->status) {
						$status_html = '<a href="' . site_url("admin/post_type_disable/{$post_type_record->id}") . '" onclick="return confirm(\'确定要隐藏吗？\')">隐藏</a>';
					} else {
						$status_html = '<a href="' . site_url("admin/post_type_enable/{$post_type_record->id}") . '" onclick="return confirm(\'确定要显示吗？\')">显示</a>';
					}
					?>
					<td><a href="<?=site_url('admin/post_type/' . $post_type_record->id)?>">编辑</a> | <?=$status_html?></td>
				</tr>
				<? endforeach; ?>
				
				</tbody>
				</table>
				
				<!--
				<div class="pagination">
	            	<ul>	   
	                	<li class="pages">Page:</li>
						<li>1</li>
						<li><a href="#" >2</a></li>
						<li><a href="#" >3</a></li>
						<li><a href="#" >4</a></li>
						<li><a href="#" >5</a></li>
						<li>...</li>
						<li><a href="#" >10</a></li>
					</ul>
	            </div>
	            -->
			</div>
		</div>
